package com.ithuaxin.comprehensiveractice;

import java.util.Random;

public class Test6 {
    public static void main(String[] args) {
        int arr[] = new int[6];
        Random r = new Random();
        for (int i=0;i<arr.length;i++){
            arr[i] = r.nextInt(101);
            System.out.println(arr[i]);
        }
        int max = arr[0];
        int min = arr[0];
        int avg;
        int sum = 0;
        for (int i = 1; i < arr.length; i++) {
            if (max<arr[i]){
                max = arr[i];
            }
            if (min>arr[i]){
                min = arr[i];
            }
        }
        for (int i = 0; i < arr.length; i++) {
            sum = sum + arr[i];
        }
        avg = (sum - max -min)/4;
        System.out.println("平均分为：" + avg);

    }
}
